// var isPalindrome = function(x) {
//     let str = x.toString();
//     let arr = str.split('')
//     let newArr = arr.reverse();
//     let newStr = newArr.join('')
//    return str === newStr
// };
let str = 'yesey'
var isPalindrome = function(x) {
    let i = 0;
    let j = str.length-1
    while (i < j)  {
        if(str[i] === str[j]){
            i++;
            j--;
        }else{
            return false
        }
    }
    return true

};
console.log(isPalindrome) //true